<?php 
    require_once("include/game_core.php");
    require_once(VIEW_BASE_FILE);
    require_once(ADMIN_CONTROLLER_FILE);
    
    
    if ( AdminController::isAdminLogin() ) {
        // Admin Logged In!!
        header( 'Location: admin_654.php' ) ;   // SECRET PAGE :)
    }
    
    
    
    $login_error ="";   //to show in the log in form

    if (isset($_POST['submit'])) {        
        // Process Form
        $uname = $_POST['uname'];
        $pass = $_POST['pass'];
        $robot = $_POST['robotsgoaway'];
        
        if ( $robot == "" ) {
            require_once(DB_FILE);
            require_once(USER_CONTROLLER_FILE);
            
            $db = new DBConnection();
            $user_cont = new UserController($db);
            
            if ( $user_cont->executeLogin($uname, $pass) ) {
                // login OK, refresh page
                header( 'Location: index.php' ) ;
            }
            else {
                $login_error = $user_cont->getErrorMSG();
            }
        }
    }
    
    $view = new view_base();
    
    $view->ShowHeader();
    $view->ShowMenu();
    $view->ShowConatinerHead();
?>
<div id="content">
        <div id="onecolumn">
                <p><img src="images/pic01.png"  alt="" /></p>
                <h2>What's your browser?</h2>
                <p>Become a browser warrior, Learn the fighting secrets,<br/>Take your favorite browser and go fighting right now!</p>
                <div class="Main_Quote">
                    “Ninjas don't wish upon a star, they throw them.”
                </div>
        </div>
        <div id="two-column">
                <div class="box-content">
                    <?php
                        // show random images
                        for ($i=0 ; $i<4 ; $i++) {
                            echo '<img src="images/game/attack/00' . rand(1,3)  . '00' . rand(1,3) . '.jpg"/>';
                        }
                    ?>
                        <!--img src="images/game/attack/001002.jpg"/><img src="images/game/attack/002003.jpg"/><img src="images/game/attack/003001.jpg"/><img src="images/game/attack/001003.jpg"/-->
                </div>
        </div>
</div>
<?php   include (VIEW_SIDE_FILE); ?>
<?php   $view->ShowFooter();      ?>